package com.fantasy.easy.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fantasy.easy.biz.domain.BizFeedback;
import com.fantasy.easy.biz.service.BizFeedbackService;
import com.fantasy.easy.biz.mapper.BizFeedbackMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 *
 */
@Service
public class BizFeedbackServiceImpl extends ServiceImpl<BizFeedbackMapper, BizFeedback>
    implements BizFeedbackService{

    @Resource
    BizFeedbackMapper bizFeedbackMapper;

    @Override
    public IPage<BizFeedback> queryAll(BizFeedback bizFeedback, Page<BizFeedback> p) {
        return bizFeedbackMapper.selectPage(p,new QueryWrapper<>(bizFeedback));
    }

    @Override
    public int insert(BizFeedback bizFeedback) {
        Integer levels = bizFeedback.getLevels();
        bizFeedback.setRanges(new BigDecimal(levels / 20 * 10000));
        return bizFeedbackMapper.updateById(bizFeedback);
    }
}




